package edu.nyu.hps.assignment9;

import java.util.ArrayList;
import java.util.Random;

public class Person {

	public String getP(int count) {
		String answer = "";

		double d[] = { 0.17, 0.11, 0.13, 0.17, 0.19, 0.23 };
		double d2[] = { 0.02, 0.03, 0.05, 0.07, 0.11, 0.13, 0.17, 0.19, 0.03,
				0.07, 0.05, 0.05, 0.03 };
		double d3[] = { 0.02, 0.03, 0.02, 0.03, 0.02, 0.03, 0.02, 0.03, 0.02,
				0.03, 0.02, 0.03, 0.02, 0.03, 0.02, 0.03, 0.02, 0.03, 0.02,
				0.03, 0.02, 0.03, 0.02, 0.03, 0.02, 0.03, 0.02, 0.03, 0.02,
				0.03, 0.02, 0.03, 0.02, 0.03, 0.02, 0.03, 0.02, 0.03, 0.02,
				0.03, };
		double d4[] = { 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,
				0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,
				0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,
				0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,
				0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,
				0.02, };

		ArrayList<Double> darlans = new ArrayList<Double>(100);

		for (int i = 0; i < 100; i++) {
			Double dd = new Double(0.0);
			darlans.add(i, dd);
		}

		boolean flag = false;
		Random r = new Random();
		double[] dthis = d4;
		for (int i = 0; i < dthis.length; i++) {
			flag = false;
			while (flag == false) {
				int pos1 = r.nextInt(100);
				int pos2 = r.nextInt(100);
				if (pos1 != pos2 && darlans.get(pos1).equals(0.00)
						&& darlans.get(pos2).equals(0.00)) {
					darlans.set(pos1, dthis[i]);
					darlans.set(pos2, -dthis[i]);
					flag = true;
				}
			}
		}

		StringBuffer sb = new StringBuffer("");
		for (Double dnum : darlans) {
			sb.append("\n" + String.format("%.2f", dnum));
		}
		// System.out.println(sb.toString());

		return sb.toString().substring(1);
	}

	public static void main(String[] args) {
		Person p = new Person();
		String person = p.getP(100);
		System.out.println(person);
	}

}
